package com.dx.bs.utils;

import java.util.Map;

public class UserContext {
    private static final ThreadLocal<String> tl = new ThreadLocal<>();

    /**
     * 保存当前登录用户信息到ThreadLocal
     *
     * @param msg
     */
    public static void setUser(String msg) {
        tl.set(msg);
    }

    /**
     * 获取当前登录用户信息
     *
     * @return 用户id
     */
    public static String getUser() {
        return tl.get();
    }

    /**
     * 移除当前登录用户信息
     */
    public static void removeUser() {
        tl.remove();
    }
}
